package cn.gcjxsc.service.worker;

import cn.gcjxsc.service.task.AutoOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author pumbaa
 */
@Component
public class NotifyWorker extends SingleWorker {
    @Autowired
    private AutoOrderService service;
    @Override
    protected void doBusiness() {
        int queueSize = service.getQueueSize();
        if (queueSize > 0) {
            service.doOrderNotify(service.poll());
        }
        try {
            Thread.sleep(50);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
